home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cocktail
/
cg.lha
/
cg
/
src
/
EvalC.mi
< prev
next >
Wrap
Text File
|
1992-11-24
|
22KB
|
781 lines
IMPLEMENTATION MODULE EvalC;
IMPORT SYSTEM, System, IO, Tree;
(* line 9 "" *)
FROM SYSTEM IMPORT ADR;
FROM IO IMPORT WriteS, WriteNl;
FROM StringMem IMPORT Length, WriteString;
FROM Idents IMPORT tIdent, GetStringRef;
FROM Texts IMPORT WriteText;
FROM Sets IMPORT IsElement;
FROM TreeC1 IMPORT BSS;
FROM TreeC2 IMPORT WriteLine;
FROM EvalC3 IMPORT ToBit0;
FROM Tree IMPORT
NoTree , tTree , Child , ClassCount ,
Computed , Reverse , Write , Read ,
Inherited , Synthesized , Input , Output ,
Stack , Variable , NoCodeClass ,
CopyDef , CopyUse , Thread , Virtual ,
Test , Left , Right ,
NonBaseComp , First , Dummy , Trace ,
Options , TreeRoot , iModule , iMain ,
itTree , ForallClasses , f , WI , WN ,
IdentifyClass, IdentifyAttribute, GrammarClass, cOAG ,
MaxVisit ;
VAR
n : SHORTCARD;
Node ,
Attr ,
ChildsClass : tTree;
PROCEDURE yyAbort (yyFunction: ARRAY OF CHAR);
BEGIN
IO.WriteS (IO.StdError, 'Error: module EvalC, routine ');
IO.WriteS (IO.StdError, yyFunction);
IO.WriteS (IO.StdError, ' failed');
IO.WriteNl (IO.StdError);
Exit;
END yyAbort;
PROCEDURE yyIsEqual (yya, yyb: ARRAY OF SYSTEM.BYTE): BOOLEAN;
VAR yyi : INTEGER;
BEGIN
FOR yyi := 0 TO INTEGER (HIGH (yya)) DO
IF yya [yyi] # yyb [yyi] THEN RETURN FALSE; END;
END;
RETURN TRUE;
END yyIsEqual;
PROCEDURE EvalDefC (t: Tree.tTree);
VAR yyTempo: RECORD CASE : INTEGER OF
END; END;
BEGIN
IF t = Tree.NoTree THEN RETURN; END;
IF (t^.Kind = Tree.Ag) THEN
(* line 43 "" *)
WITH t^.Ag DO
(* line 43 "" *)
WriteS (f, "# ifndef yy"); WI (EvalName); WriteNl (f);
WriteS (f, "# define yy"); WI (EvalName); WriteNl (f);
WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, "# define ARGS(parameters) parameters"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, "# define ARGS(parameters) ()"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteNl (f);
WriteS (f, '# include "'); WI (iMain); WriteS (f, '.h"'); WriteNl (f);
WriteNl (f);
WriteLine (EvalCodes^.Codes.ImportLine);
WriteText (f, EvalCodes^.Codes.Import);
Node := Modules;
WHILE Node^.Kind = Tree.Module DO
WriteLine (Node^.Module.EvalCodes^.Codes.ImportLine);
WriteText (f, Node^.Module.EvalCodes^.Codes.Import);
Node := Node^.Module.Next;
END;
WriteLine (EvalCodes^.Codes.ExportLine);
WriteText (f, EvalCodes^.Codes.Export);
Node := Modules;
WHILE Node^.Kind = Tree.Module DO
WriteLine (Node^.Module.EvalCodes^.Codes.ExportLine);
WriteText (f, Node^.Module.EvalCodes^.Codes.Export);
Node := Node^.Module.Next;
END;
WriteNl (f);
WriteS (f, "extern void "); WI (EvalName); WriteS (f, " ARGS(("); WI (itTree); WriteS (f, " yyt));"); WriteNl (f);
WriteS (f, "extern void Begin"); WI (EvalName); WriteS (f, " ();"); WriteNl (f);
WriteS (f, "extern void Close"); WI (EvalName); WriteS (f, " ();"); WriteNl (f);
WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
;
RETURN;
END;
END;
END EvalDefC;
PROCEDURE EvalImplHead (t: Tree.tTree);
VAR yyTempo: RECORD CASE : INTEGER OF
END; END;
BEGIN
IF t = Tree.NoTree THEN RETURN; END;
IF (t^.Kind = Tree.Ag) THEN
(* line 81 "" *)
WITH t^.Ag DO
(* line 81 "" *)
WriteS (f, "# define DEP(a, b) a"); WriteNl (f);
WriteS (f, "# define SELF yyt"); WriteNl (f);
WriteS (f, '# include "'); WI (EvalName); WriteS (f, '.h"'); WriteNl (f);
IF IsElement (ORD ('Y'), Options) OR
IsElement (ORD ('Z'), Options) OR
IsElement (ORD ('L'), Options) THEN
WriteS (f, '# include <stdio.h>'); WriteNl (f);
END;
IF IsElement (ORD ('Y'), Options) OR
IsElement (ORD ('Z'), Options) THEN
WriteS (f, "# ifdef __cplusplus"); WriteNl (f);
WriteS (f, 'extern "C" {'); WriteNl (f);
WriteS (f, '# include "Idents.h"'); WriteNl (f);
WriteS (f, '# include "Sets.h"'); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, '# include "Idents.h"'); WriteNl (f);
WriteS (f, '# include "Sets.h"'); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
END;
IF IsElement (ORD ('9'), Options) THEN
WriteS (f, "# ifdef __cplusplus"); WriteNl (f);
WriteS (f, 'extern "C" {'); WriteNl (f);
WriteS (f, '# include "General.h"'); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, '# include "General.h"'); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteNl (f);
WriteS (f, "static int xxStack;"); WriteNl (f);
END;
WriteLine (EvalCodes^.Codes.GlobalLine);
WriteText (f, EvalCodes^.Codes.Global);
Node := Modules;
WHILE Node^.Kind = Tree.Module DO
WriteLine (Node^.Module.EvalCodes^.Codes.GlobalLine);
WriteText (f, Node^.Module.EvalCodes^.Codes.Global);
Node := Node^.Module.Next;
END;
WriteNl (f);
IF IsElement (ORD ('X'), Options) THEN
WriteS (f, '# include "yy'); WI (iModule); WriteS (f, '.w"'); WriteNl (f);
WriteS (f, "# define yyWrite"); WI (iMain); WriteS (f, "(a) Write"); WI (iMain); WriteS (f, " (yyf, a)"); WriteNl (f);
END;
WriteNl (f);
WriteS (f, "static char yyb;"); WriteNl (f);
IF IsElement (ORD ('Y'), Options) OR
IsElement (ORD ('Z'), Options) THEN
WriteNl (f);
WriteS (f, "# define yyTrace true"); WriteNl (f);
WriteNl (f);
WriteS (f, "static char * yyTypeName ["); WN (ClassCount); WriteS (f, " + 1] = { 0,"); WriteNl (f);
ForallClasses (Classes, TypeName);
WriteS (f, "};"); WriteNl (f);
WriteNl (f);
WriteS (f, "static void yyWriteType"); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " ("); WI (itTree); WriteS (f, " yyt)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyt) "); WI (itTree); WriteS (f, " yyt;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteS (f, "{"); WriteNl (f);
WriteS (f, " char * yys = yyTypeName [yyt->Kind];"); WriteNl (f);
WriteS (f, " register int yyi = 16 - strlen (yys);"); WriteNl (f);
WriteS (f, ' (void) printf ("%s", yys);'); WriteNl (f);
WriteS (f, " while (yyi -- > 0) (void) putc (' ', stdout);"); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
END;
IF IsElement (ORD ('X'), Options) THEN
WriteNl (f);
WriteS (f, "static FILE * yyf = stdout;"); WriteNl (f);
WriteNl (f);
WriteS (f, "static void yyWriteHex"); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " (unsigned char * yyx, int yysize)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyx, yysize) unsigned char * yyx; int yysize;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteS (f, '{ register int yyi; for (yyi = 0; yyi < yysize; yyi ++) (void) printf ("%02x ", yyx [yyi]); }'); WriteNl (f);
WriteNl (f);
WriteS (f, "static void yyWriteNl () { if (yyTrace) { (void) putc ('\n', stdout); (void) fflush (stdout); } }"); WriteNl (f);
END;
IF IsElement (ORD ('X'), Options) THEN
WriteNl (f);
WriteS (f, "static void yyWriteEval"); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " ("); WI (itTree); WriteS (f, " yyt, char * yys)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyt, yys) "); WI (itTree); WriteS (f, " yyt; char * yys;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteS (f, "{"); WriteNl (f);
WriteS (f, " if (yyTrace) {"); WriteNl (f);
WriteS (f, " register int yyi = 24 - strlen (yys);"); WriteNl (f);
WriteS (f, " yyWriteType (yyt);"); WriteNl (f);
WriteS (f, ' (void) printf (" e %s", yys);'); WriteNl (f);
WriteS (f, " while (yyi -- > 0) (void) putc (' ', stdout);"); WriteNl (f);
WriteS (f, ' (void) printf (" = ");'); WriteNl (f);
WriteS (f, " (void) fflush (stdout);"); WriteNl (f);
WriteS (f, " }"); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
ELSIF IsElement (ORD ('Y'), Options) THEN
WriteNl (f);
WriteS (f, "static void yyWriteEval"); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " ("); WI (itTree); WriteS (f, " yyt, char * yys)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyt, yys) "); WI (itTree); WriteS (f, " yyt; char * yys;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteS (f, "{"); WriteNl (f);
WriteS (f, " if (yyTrace) {"); WriteNl (f);
WriteS (f, " yyWriteType (yyt);"); WriteNl (f);
WriteS (f, ' (void) printf (" e %s\n", yys);'); WriteNl (f);
WriteS (f, " (void) fflush (stdout);"); WriteNl (f);
WriteS (f, " }"); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
END;
IF IsElement (ORD ('Z'), Options) THEN
WriteNl (f);
WriteS (f, "static void yyWriteVisit"); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " ("); WI (itTree); WriteS (f, " yyt, char * yys)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyt, yys) "); WI (itTree); WriteS (f, " yyt; char * yys;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteS (f, "{"); WriteNl (f);
WriteS (f, " if (yyTrace) {"); WriteNl (f);
WriteS (f, " yyWriteType (yyt);"); WriteNl (f);
WriteS (f, ' (void) printf (" v %s\n", yys);'); WriteNl (f);
WriteS (f, " (void) fflush (stdout);"); WriteNl (f);
WriteS (f, " }"); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
WriteNl (f);
WriteS (f, "static void yyVisitParent"); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " ("); WI (itTree); WriteS (f, " yyt)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyt) "); WI (itTree); WriteS (f, " yyt;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteS (f, '{ yyWriteVisit (yyt, "parent"); }'); WriteNl (f);
END;
;
RETURN;
END;
END;
END EvalImplHead;
PROCEDURE EvalImplC (t: Tree.tTree);
VAR yyTempo: RECORD CASE : INTEGER OF
END; END;
BEGIN
IF t = Tree.NoTree THEN RETURN; END;
IF (t^.Kind = Tree.Ag) THEN
(* line 226 "" *)
WITH t^.Ag DO
(* line 226 "" *)
EvalImplHead (t);
WriteNl (f);
FOR n := 1 TO MaxVisit DO
WriteS (f, "static void yyVisit"); WN (n); WriteS (f, " ARGS((register "); WI (itTree); WriteS (f, " yyt));"); WriteNl (f);
END;
WriteNl (f);
WriteS (f, "void "); WI (EvalName); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " ("); WI (itTree); WriteS (f, " yyt)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyt) "); WI (itTree); WriteS (f, " yyt;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
IF NOT IsElement (ORD ('9'), Options) THEN
WriteS (f, "{ "); IF MaxVisit > 0 THEN WriteS (f, "yyVisit1 (yyt); "); END; WriteS (f, "}"); WriteNl (f);
ELSE
WriteS (f, "{"); WriteNl (f);
WriteS (f, " char xxHigh;"); WriteNl (f);
WriteS (f, " xxStack = 1000000000;"); WriteNl (f);
IF MaxVisit > 0 THEN
WriteS (f, " yyVisit1 (yyt);"); WriteNl (f);
END;
WriteS (f, ' (void) printf ("Stacksize %d\n", (int) & xxHigh - xxStack);'); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
END;
WriteNl (f);
FOR n := 1 TO MaxVisit DO
WriteS (f, "static void yyVisit"); WN (n); WriteNl (f);
WriteS (f, "# if defined __STDC__ | defined __cplusplus"); WriteNl (f);
WriteS (f, " (register "); WI (itTree); WriteS (f, " yyt)"); WriteNl (f);
WriteS (f, "# else"); WriteNl (f);
WriteS (f, " (yyt) register "); WI (itTree); WriteS (f, " yyt;"); WriteNl (f);
WriteS (f, "# endif"); WriteNl (f);
WriteS (f, "{"); WriteNl (f);
WriteLine (EvalCodes^.Codes.LocalLine);
WriteText (f, EvalCodes^.Codes.Local);
Node := Modules;
WHILE Node^.Kind = Tree.Module DO
WriteLine (Node^.Module.EvalCodes^.Codes.LocalLine);
WriteText (f, Node^.Module.EvalCodes^.Codes.Local);
Node := Node^.Module.Next;
END;
IF IsElement (ORD ('9'), Options) THEN
WriteS (f, " char xxLow;"); WriteNl (f);
WriteS (f, " xxStack = Min (xxStack, (int) & xxLow);"); WriteNl (f);
END;
WriteNl (f);
WriteS (f, " switch (yyt->Kind) {"); WriteNl (f);
IF cOAG IN GrammarClass THEN (* generate evaluator *)
ForallClasses (Classes, GenEvaluator);
END;
WriteS (f, " default: ;"); WriteNl (f);
IF IsElement (ORD ('Z'), Options) THEN
WriteS (f, " yyVisitParent (yyt);"); WriteNl (f);
END;
WriteS (f, " }"); WriteNl (f);
WriteS (f, "}"); WriteNl (f);
WriteNl (f);
END;
WriteS (f, "void Begin"); WI (EvalName); WriteS (f, " ()"); WriteNl (f);
WriteS (f, "{"); WriteNl (f);
WriteLine (EvalCodes^.Codes.BeginLine);
WriteText (f, EvalCodes^.Codes.Begin);
Node := Modules;
WHILE Node^.Kind = Tree.Module DO
WriteLine (Node^.Module.EvalCodes^.Codes.BeginLine);
WriteText (f, Node^.Module.EvalCodes^.Codes.Begin);
Node := Node^.Module.Next;
END;
WriteS (f, "}"); WriteNl (f);
WriteNl (f);
WriteS (f, "void Close"); WI (EvalName); WriteS (f, " ()"); WriteNl (f);
WriteS (f, "{"); WriteNl (f);
WriteLine (EvalCodes^.Codes.CloseLine);
WriteText (f, EvalCodes^.Codes.Close);
Node := Modules;
WHILE Node^.Kind = Tree.Module DO
WriteLine (Node^.Module.EvalCodes^.Codes.CloseLine);
WriteText (f, Node^.Module.EvalCodes^.Codes.Close);
Node := Node^.Module.Next;
END;
WriteS (f, "}"); WriteNl (f);
;
RETURN;
END;
END;
END EvalImplC;
PROCEDURE TypeName (t: Tree.tTree);
VAR yyTempo: RECORD CASE : INTEGER OF
END; END;
BEGIN
IF t = Tree.NoTree THEN RETURN; END;
IF (t^.Kind = Tree.Class) THEN
(* line 313 "" *)
LOOP
WITH t^.Class DO
(* line 314 "" *)
IF NOT (NoCodeClass * Properties = {}) THEN EXIT; END;
(* line 315 "" *)
IF NOT (Trace IN Properties) THEN EXIT; END;
(* line 316 "" *)
WriteS (f, '"');
(* line 316 "" *)
WI (Name);
(* line 316 "" *)
WriteS (f, '",');
(* line 316 "" *)
WriteNl (f);
RETURN;
END;
END;
END;
END TypeName;
PROCEDURE GenEvaluator (t: Tree.tTree);
VAR yyTempo: RECORD CASE : INTEGER OF
| 8: yyR8: RECORD
TheClass: Tree.tTree;
k: INTEGER;
END;
END; END;
BEGIN
IF t = Tree.NoTree THEN RETURN; END;
CASE t^.Kind OF
| Tree.Class:
(* line 321 "" *)
LOOP
WITH t^.Class DO
(* line 322 "" *)
IF NOT (NoCodeClass * Properties = {}) THEN EXIT; END;
(* line 323 "" *)
IF (Generated = InstCount) OR (Visits < n) THEN RETURN; END;
WriteNl (f);
WriteS (f, "case k"); WI (Name); WriteS (f, ":"); WriteNl (f);
Class := t;
LOOP
IF Generated = InstCount THEN EXIT; END;
INC (Generated);
WITH Instance^ [Instance^ [Generated].Order] DO
IF (Left IN Properties) AND (Attribute^.Child.Partition > n) THEN
DEC (Generated); EXIT;
END;
IF ({Inherited, Right, First} <= Properties) AND NOT (Virtual IN Properties) THEN
IF IsElement (ORD ('X'), Options) AND (Trace IN t^.Class.Properties) THEN
WriteS (f, 'yyWriteEval (yyt, "'); WI (Selector^.Child.Name); WriteS (f, ":"); WI (Attribute^.Child.Name); WriteS (f, '");'); WriteNl (f);
IF Action # ADR (Action) THEN GenEvaluator (Action); END; WriteNl (f);
IF (Attribute^.Kind = Tree.Child) OR (Attribute^.Attribute.Type = itTree) THEN
WriteS (f, "write"); WI (itTree);
WriteS (f, " (yyt->"); WI (Name); WriteS (f, "."); WI (Selector^.Child.Name);
WriteS (f, "->"); WI (Selector^.Child.Type); WriteS (f, "."); WI (Attribute^.Child.Name); WriteS (f, ")"); WriteNl (f);
ELSE
WriteS (f, "write"); WI (Attribute^.Child.Type);
WriteS (f, " (yyt->"); WI (Name); WriteS (f, "."); WI (Selector^.Child.Name);
WriteS (f, "->"); WI (Selector^.Child.Type); WriteS (f, "."); WI (Attribute^.Child.Name); WriteS (f, ") yyWriteNl ();"); WriteNl (f);
END;
ELSIF IsElement (ORD ('Y'), Options) AND (Trace IN t^.Class.Properties) THEN
WriteS (f, 'yyWriteEval (yyt, "'); WI (Selector^.Child.Name); WriteS (f, ":"); WI (Attribute^.Child.Name); WriteS (f, '");'); WriteNl (f);
IF Action # ADR (Action) THEN GenEvaluator (Action); END;
ELSE
IF Action # ADR (Action) THEN GenEvaluator (Action); END;
END;
END;
IF ({Synthesized, Left, First} <= Properties) AND ({Dummy, Virtual} * Properties = {}) THEN
IF IsElement (ORD ('X'), Options) AND (Trace IN t^.Class.Properties) THEN
WriteS (f, 'yyWriteEval (yyt, "'); WI (Attribute^.Child.Name); WriteS (f, '");'); WriteNl (f);
IF Action # ADR (Action) THEN GenEvaluator (Action); END; WriteNl (f);
IF Test IN Properties THEN
WriteS (f, "writebool (yyb) yyWriteNl ();"); WriteNl (f);
ELSIF (Attribute^.Kind = Tree.Child) OR (Attribute^.Attribute.Type = itTree) THEN
WriteS (f, "write"); WI (itTree);
WriteS (f, " (yyt->"); WI (Name); WriteS (f, "."); WI (Attribute^.Child.Name); WriteS (f, ")");
ELSE
WriteS (f, "write"); WI (Attribute^.Child.Type);
WriteS (f, " (yyt->"); WI (Name); WriteS (f, "."); WI (Attribute^.Child.Name); WriteS (f, ") yyWriteNl ();"); WriteNl (f);
END;
ELSIF IsElement (ORD ('Y'), Options) AND (Trace IN t^.Class.Properties) THEN
WriteS (f, 'yyWriteEval (yyt, "'); WI (Attribute^.Child.Name); WriteS (f, '");'); WriteNl (f);
IF Action # ADR (Action) THEN GenEvaluator (Action); END;
ELSE
IF Action # ADR (Action) THEN GenEvaluator (Action); END;
END;
END;
IF ({Synthesized, Right, First} <= Properties) AND
(Attribute^.Child.Partition <= Selector^.Child.Class^.Class.Visits) THEN
IF IsElement (ORD ('Z'), Options) AND (Trace IN t^.Class.Properties) THEN
WriteS (f, 'yyWriteVisit (yyt, "'); WI (Selector^.Child.Name); WriteS (f, " ");
WN (Attribute^.Child.Partition); WriteS (f, '");'); WriteNl (f);
END;
WriteS (f, "yyVisit"); WN (Attribute^.Child.Partition);
WriteS (f, " (yyt->"); WI (Name); WriteS (f, "."); WI (Selector^.Child.Name); WriteS (f, ");"); WriteNl (f);
END;
END;
END;
IF IsElement (ORD ('Z'), Options) AND (Trace IN t^.Class.Properties) THEN
WriteS (f, "yyVisitParent (yyt);"); WriteNl (f);
END;
WriteS (f, "break;"); WriteNl (f);
;
RETURN;
END;
END;
| Tree.Assign:
(* line 390 "" *)
WITH t^.Assign DO
(* line 390 "" *)
WriteLine (Pos);
GenEvaluator (Results); WriteS (f, "="); GenEvaluator (Arguments); WriteS (f, ";"); WriteNl (f);
;
RETURN;
END;
| Tree.Copy:
(* line 394 "" *)
WITH t^.Copy DO
(* line 394 "" *)
WriteLine (Pos);
GenEvaluator (Results); WriteS (f, "="); GenEvaluator (Arguments); WriteS (f, ";"); WriteNl (f);
;
RETURN;
END;
| Tree.TargetCode:
(* line 398 "" *)
WITH t^.TargetCode DO
(* line 398 "" *)
WriteLine (Pos);
GenEvaluator (Code); WriteNl (f);
;
RETURN;
END;
| Tree.Check:
(* line 402 "" *)
WITH t^.Check DO
(* line 402 "" *)
WriteLine (Pos);
IF Condition # NoTree THEN
WriteS (f, 'if (! (');
IF IsElement (ORD ('X'), Options) THEN
WriteS (f, "yyb = ");
END;
GenEvaluator (Condition); WriteS (f, ")) {"); GenEvaluator (Statement); WriteS (f, "; }"); WriteNl (f);
IF Actions^.Kind = Tree.Check THEN
WriteS (f, "else"); WriteNl (f);
GenEvaluator (Actions);
END;
ELSE
IF IsElement (ORD ('X'), Options) THEN
WriteS (f, "yyb = false; ");
END;
GenEvaluator (Statement); WriteS (f, ";"); WriteNl (f);
GenEvaluator (Actions);
END;
;
RETURN;
END;
| Tree.Designator:
(* line 422 "" *)
WITH t^.Designator DO
(* line 422 "" *)
Attr := IdentifyAttribute (Class, Selector);
IF Attr # NoTree THEN
ChildsClass := Attr^.Child.Class;
Attr := IdentifyAttribute (ChildsClass, Attribute);
IF NOT (Virtual IN Attr^.Attribute.Properties) THEN
WriteS (f, "yyt->"); WI (Class^.Class.Name); WriteS (f, "."); WI (Selector); WriteS (f, "->");
WI (ChildsClass^.Class.Name); WriteS (f, "."); WI (Attribute);
END;
ELSE
WI (Selector); WriteS (f, ":"); WI (Attribute);
END;
GenEvaluator (Next);
;
RETURN;
END;
| Tree.Ident:
(* line 436 "" *)
WITH t^.Ident DO
(* line 436 "" *)
Attr := IdentifyAttribute (Class, Attribute);
IF Attr # NoTree THEN
IF NOT (Virtual IN Attr^.Attribute.Properties) THEN
WriteS (f, "yyt->"); WI (Class^.Class.Name); WriteS (f, "."); WI (Attribute);
END;
ELSE
WI (Attribute);
END;
GenEvaluator (Next);
;
RETURN;
END;
| Tree.Remote:
(* line 447 "" *)
WITH yyTempo.yyR8 DO
WITH t^.Remote DO
(* line 448 "" *)
;
(* line 448 "" *)
;
(* line 449 "" *)
TheClass := IdentifyClass (TreeRoot ^ . Ag . Classes, Type);
(* line 450 "" *)
IF TheClass # NoTree THEN
Attr := IdentifyAttribute (TheClass, Attribute);
IF Attr # NoTree THEN
WITH Attr^.Attribute DO
k := ToBit0 (TheClass, AttrIndex);
IF Synthesized IN Properties THEN
WriteS (f, "REMOTE_SYN (yyIsComp"); WN (k DIV BSS); WriteS (f, ", "); WN (k MOD BSS); WriteS (f, ", yyS"); WN (k); WriteS (f, ", ");
GenEvaluator (Designators); WriteS (f, ", "); WI (t^.Remote.Type); WriteS (f, ", "); WI (Attribute); WriteS (f, ")");
ELSIF Inherited IN Properties THEN
WriteS (f, "REMOTE_INH (yyIsComp"); WN (k DIV BSS); WriteS (f, ", "); WN (k MOD BSS); WriteS (f, ", "); WN (k); WriteS (f, ", ");
GenEvaluator (Designators); WriteS (f, ", "); WI (t^.Remote.Type); WriteS (f, ", "); WI (Attribute); WriteS (f, ")");
ELSE
GenEvaluator (Designators); WriteS (f, "->"); WI (t^.Remote.Type); WriteS (f, "."); WI (Attribute);
END;
END;
END;
END;
GenEvaluator (Next);
;
RETURN;
END;
END;
| Tree.Any:
(* line 469 "" *)
WITH t^.Any DO
(* line 469 "" *)
WriteString (f, Code);
GenEvaluator (Next);
;
RETURN;
END;
| Tree.Anys:
(* line 473 "" *)
WITH t^.Anys DO
(* line 473 "" *)
GenEvaluator (Layouts);
GenEvaluator (Next);
;
RETURN;
END;
| Tree.LayoutAny:
(* line 477 "" *)
WITH t^.LayoutAny DO
(* line 477 "" *)
WriteString (f, Code);
GenEvaluator (Next);
;
RETURN;
END;
ELSE END;
END GenEvaluator;
PROCEDURE BeginEvalC;
BEGIN
END BeginEvalC;
PROCEDURE CloseEvalC;
BEGIN
END CloseEvalC;
PROCEDURE yyExit;
BEGIN
IO.CloseIO; System.Exit (1);
END yyExit;
BEGIN
yyf := IO.StdOutput;
Exit := yyExit;
BeginEvalC;
END EvalC.